fix(pipeline): preserve ADR across full re-index (#516)fix(pipeline): preserve ADR across full re-index (#516)#539
Conversation
manage_adr stores ADRs in project_summaries, but a full re-index (triggered by file changes or new files) deletes the DB in try_incremental_or_delete_db and rebuilds it from the graph buffer, which writes an empty project_summaries table. file_hashes were re-persisted after the rebuild but project_summaries were not, so the ADR was silently lost. Fix: capture the ADR before the DB is unlinked, stash it on the pipeline struct, and restore it after the rebuilt DB is reopened in dump_and_persist_hashes. The incremental path is unaffected (it never rewrites the DB). Verified: ADR now survives a full re-index. Signed-off-by: RithvikReddy0-0 <rithvikreddymukkara@gmail.com>
|
Thanks @RithvikReddy0-0 — the ADR save/restore around the delete/rebuild path is the right fix for #516. Two things before merge:
(For info: the doubled commit title is just a cosmetic git artifact — the diff itself is clean and not duplicated.) 🙏 |
|
Confirming the two concerns from a closer pass:
Both can go in alongside the reproduce-first test. 🙏 |
…ata#516) Addresses review on DeusData#539. - Free p->saved_adr in cbm_pipeline_free so it is not leaked on error paths that exit before the restore in dump_and_persist_hashes (e.g. a cbm_gbuf_dump_to_sqlite failure). - Check cbm_store_adr_store's return value on restore and log an error instead of silently dropping the ADR (the original DeusData#516 symptom). - Add reproduce-first test pipeline_adr_survives_full_reindex: index, store an ADR, force a full re-index by adding files, assert the ADR survives unchanged. Passes against the fix. Signed-off-by: RithvikReddy0-0 <rithvikreddymukkara@gmail.com>
|
Thanks — all three addressed in 2f434d4. Leak. Unchecked restore. Test. Added One note from running the full suite locally: |
|
Thanks @RithvikReddy0-0 — all three review items are addressed now (the |
What does this PR do?
Fixes #516. ADRs stored via
manage_adrwere silently deleted on a fullre-index. Captures the ADR before the DB is deleted and restores it after the
rebuild. Only the full-dump path was affected (incremental never rewrites the DB).
Verified: index → store ADR → change/add files → re-index → ADR survives
(previously returned
no_adr).Checklist
git commit -s) — required, CI rejectsunsigned commits (DCO, see CONTRIBUTING.md)
make -f Makefile.cbm test)make -f Makefile.cbm lint-ci)